package com.hfjyz.judge.judgecall.bean;

import java.util.ArrayList;
import java.util.List;

import com.hfjyz.base.entity.CallEntity;
import com.hfjyz.base.entity.JudgeEntity;
import com.hfjyz.base.util.CodeUtil;
import com.hfjyz.call.bean.CallBean;
import com.hfjyz.judge.judge.bean.JudgeBean;
import com.hfjyz.judge.judgecall.entity.JudgeCallEntity;

public class JudgeCallBean extends CallBean {

    /**
     * serialVersionUID
     */
    private static final long serialVersionUID = 3264527583628775170L;
    protected JudgeBean target = null;
    protected final Integer callType = 1;

    public JudgeCallBean() {
    }

    public JudgeCallBean(CallEntity call, JudgeEntity judge) {
        id = call.getId();
        callName = call.getCallName();
        callReason = call.getCallReason();
        callRemark = call.getCallRemark();
        target = new JudgeBean(judge);
        callAim = call.getCallAim();
    }
    
    public JudgeCallBean(JudgeCallEntity call) {
        id = call.getId();
        callName = call.getCallName();
        callReason = call.getCallReason();
        callRemark = call.getCallRemark();
        target = new JudgeBean(call.getTarget());
        callAim = call.getCallAim();
    }

    public Integer getCallType() {
        return callType;
    }

    public JudgeBean getTarget() {
        return target;
    }

    public void setTarget(JudgeBean target) {
        this.target = target;
    }

    @Override
    public List<String> toJsonArray(int index) {
        List<String> result = new ArrayList<String>();
        result.add(String.valueOf(index + 1));
        result.add(target.getIdNo());
        result.add(target.getName());
        result.add(CodeUtil.getSexString(target.getSex()));
        result.add(callName);
        result.add(CodeUtil.getCallAimText(callAim));
        result.add(callReason);
        result.add(callRemark);

        return result;
    }

}
